home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
pctj8410.arc
/
NR_PRINT.ASM
< prev
next >
Wrap
Assembly Source File
|
1986-09-14
|
2KB
|
46 lines
; ROUTINE TO PRINT ASCII DATA TO A COLOR MONITOR
; USER CAN DEFINE FOREGROUND AND BACKGROUND
; COLORS TO USE
; WRITTEN BY DON AWALT
; edit 12/83
;
DLR_SIGN EQU '$' ;terminating character for input string
SPCL_BLANK EQU 128
;
NR_PRINT PROC NEAR ;input in dx, term by '$'
MOV DI,DX ;save in di for later use
MOV SI,DX ;save here also
MOV CX,0 ;will tell nr of characters
;to blank
GET_SIZE:
MOV AL,[SI] ;first (or next) char of string
SUB AL,DLR_SIGN ;compare with term character
JZ BLANK_IT ;if equal, found the $
INC CX ;count 1 more character
INC SI ;advance to next in string
JMP GET_SIZE ;go again
BLANK_IT: ;now to blank all positions at once
MOV BH,0 ;page nr for bios call
MOV AL,SPCL_BLANK ;defined in listing 2;
;ascii 128
MOV BL,1 ;color for background (1)
MOV AH,9 ;write character function
INT 10H ;video bios call
P_NXT:
CMP BYTE PTR [DI],DLR_SIGN ;done?
JE PRINT_COMPLETE ;yes we hit dollar sign
MOV AL,[DI] ;now get character to display
INC DI ;prepare for getting next char
MOV BL,82H ;color 2 (with background 1
;gives color 3)
MOV AH,9 ;write character function
MOV BH,0 ;display page 0
MOV CX,1 ;write 1 character
INT 10H ;call bios (video)
CALL CURSOR_SET ;listing 3; advance cursor
JMP P_NXT ;see if any more characters
PRINT_COMPLETE:
RET ;done the work
NR_PRINT ENDP